Ext.require([ 'Ext.data.identifier.*' ]);

Ext.onReady(function() {

	Ext.define('Login', {
		extend : 'Ext.window.Window',

		// This config is not compatible with the more common "controller"
		// config
		// used to specify a ViewController for the view. When a ViewController
		// is
		// specified it effectively acts as the "reference holder" for the view.
		// In
		// this example we simply mark this container as the reference holder
		// for
		// demonstration purposes.
		referenceHolder : true,
		boder : false,
		title : '登录',
		items : [ {
			xtype : 'form',
			widht : 300,
			items : [ {
				margin : 3,
				xtype : 'textfield',
				labelAlign : 'right',
				reference : 'username', // A named reference to be held on the
										// referenceHolder
				name : 'username',
				fieldLabel : '用户名'
			}, {
				margin : 3,
				xtype : 'textfield',
				labelAlign : 'right',
				reference : 'password', // A named reference to be held on the
				inputType:'password',						// referenceHolder
				name : 'password',
				fieldLabel : '密码'
			} ]
		} ]
	});

	var w = Ext.create('Login');
	w.show();

	var updateClock = function() {
		console.log(w.lookupReference('password').getValue()); // The password
																// field
	};

	var runner = Ext.create('Ext.util.TaskRunner');
	var task = runner.newTask({
		run : function() {
			// useful code
			updateClock();
		},
		interval : 1000
	});
	task.start();

	w.on('close', function() {
		task.stop();
	});

});